package cn.edu.tsinghua.training.cms.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import cn.edu.tsinghua.training.cms.demo.dao.GenericDao;
import cn.edu.tsinghua.training.cms.demo.entity.Channel;
import cn.edu.tsinghua.training.cms.demo.service.ChannelService;
import cn.edu.tsinghua.training.cms.demo.util.PageBean;

@Service
public class ChannelServiceImpl extends GenericServiceImpl<Channel, Long> implements ChannelService {
	
	@Override
	@Autowired
	@Qualifier("channelDaoImpl")
	public void setGenericDao(GenericDao<Channel, Long> genericDao) {
		super.setGenericDao(genericDao);
	}

	@Override
	public PageBean list(int pageSize, int page) {
		return genericDao.queryForPage("from Channel where status=0", null, null, pageSize, page);
	}

	@Override
	public List<Channel> list() {
		return genericDao.query("from Channel where status=0", null, null);
	}

}
